/*     */ package eos.moe.dragoncore;
/*     */ 
/*     */ import com.google.common.cache.Cache;
/*     */ import com.google.common.cache.CacheBuilder;
/*     */ import com.google.common.cache.RemovalListener;
/*     */ import com.google.common.cache.RemovalNotification;
/*     */ import java.util.LinkedHashMap;
/*     */ import java.util.Map;
/*     */ import java.util.UUID;
/*     */ import java.util.concurrent.TimeUnit;
/*     */ import net.minecraft.client.Minecraft;
/*     */ import net.minecraft.client.multiplayer.WorldClient;
/*     */ import net.minecraft.entity.Entity;
/*     */ import net.minecraft.entity.EntityLivingBase;
/*     */ import net.minecraftforge.client.event.RenderLivingEvent;
/*     */ import net.minecraftforge.event.entity.EntityJoinWorldEvent;
/*     */ import net.minecraftforge.event.entity.living.LivingEvent;
/*     */ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/*     */ import net.minecraftforge.fml.common.gameevent.TickEvent;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class kq
/*     */   implements RemovalListener<UUID, zz>
/*     */ {
/*  34 */   public static kq q = new kq();
/*     */   
/*     */   public Cache<UUID, zz> g;
/*     */ 
/*     */   
/*     */   public kq() {
/*  40 */     CacheBuilder cacheBuilder = CacheBuilder.newBuilder();
/*     */     
/*  42 */     cacheBuilder.expireAfterAccess(1L, TimeUnit.MINUTES);
/*  43 */     cacheBuilder.removalListener(this);
/*     */     
/*  45 */     this.g = cacheBuilder.build();
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public void onRemoval(RemovalNotification removalNotification) {}
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public void beforeLivingRender(RenderLivingEvent.Pre pre) {
/*  55 */     EntityLivingBase entityLivingBase = pre.getEntity();
/*  56 */     zz zz = (zz)this.g.getIfPresent(entityLivingBase.func_110124_au());
/*  57 */     if (zz != null) {
/*  58 */       dt.v(zz, pre.getPartialRenderTick());
/*     */     }
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public void onJoin(EntityJoinWorldEvent entityJoinWorldEvent) {
/*     */     try {
/*  68 */       if (entityJoinWorldEvent.getEntity() instanceof EntityLivingBase) {
/*  69 */         init((EntityLivingBase)entityJoinWorldEvent.getEntity(), true);
/*     */       }
/*  71 */     } catch (Exception exception) {}
/*     */   }
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public void onJump(LivingEvent.LivingJumpEvent livingJumpEvent) {
/*  77 */     zz zz = (zz)this.g.getIfPresent(livingJumpEvent.getEntityLiving().func_110124_au());
/*  78 */     if (zz != null) {
/*  79 */       zz.v(st.l, new String[0]);
/*  80 */       zz.v("jump", "true");
/*     */     } 
/*     */   }
/*     */   
/*     */   @SubscribeEvent
/*     */   public void onTick(TickEvent.ClientTickEvent clientTickEvent) {
/*  86 */     if (clientTickEvent.phase != TickEvent.Phase.START) {
/*     */       return;
/*     */     }
/*  89 */     WorldClient worldClient = (Minecraft.func_71410_x()).field_71441_e;
/*  90 */     if (worldClient == null) {
/*     */       return;
/*     */     }
/*  93 */     for (Entity entity : worldClient.func_72910_y()) {
/*  94 */       if (checkNameChange(entity)) {
/*  95 */         init((EntityLivingBase)entity, false);
/*     */       }
/*  97 */       if (entity instanceof EntityLivingBase) {
/*  98 */         EntityLivingBase entityLivingBase = (EntityLivingBase)entity;
/*  99 */         zz zz = (zz)this.g.getIfPresent(entityLivingBase.func_110124_au());
/* 100 */         if (zz != null) {
/* 101 */           zz.w.v(entity);
/*     */           
/* 103 */           int i = Integer.parseInt(zz.v("hurtTime", "0"));
/* 104 */           int j = entityLivingBase.field_70737_aN;
/* 105 */           if (j > i) {
/* 106 */             zz.v(st.t, new String[0]);
/*     */           }
/* 108 */           zz.v("hurtTime", String.valueOf(j));
/*     */           
/* 110 */           if (zz.v("jump", "false").equals("true") && entity.field_70122_E) {
/* 111 */             zz.v("jump", "false");
/*     */           }
/*     */ 
/*     */           
/* 115 */           zz.v(st.z, new String[0]);
/*     */         } 
/*     */       } 
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public boolean checkNameChange(Entity entity) {
/* 125 */     zz zz = (zz)this.g.getIfPresent(entity.func_110124_au());
/* 126 */     return (zz != null && !zz.f.equals(entity.func_70005_c_()));
/*     */   }
/*     */ 
/*     */   
/*     */   public void init(EntityLivingBase entityLivingBase, boolean bool) {
/* 131 */     if (bool && this.g.getIfPresent(entityLivingBase.func_110124_au()) != null && !checkNameChange((Entity)entityLivingBase)) {
/*     */       return;
/*     */     }
/*     */     
/* 135 */     xea.eos/moe/dragoncore/ija eos/moe/dragoncore/ija = xea.m.v(entityLivingBase);
/* 136 */     if (eos/moe/dragoncore/ija == null || eos/moe/dragoncore/ija.t()) {
/*     */       return;
/*     */     }
/* 139 */     xea.eos/moe/dragoncore/tga eos/moe/dragoncore/tga = eos/moe/dragoncore/ija.v();
/* 140 */     if (eos/moe/dragoncore/tga == null || eos/moe/dragoncore/tga.v() == null || eos/moe/dragoncore/tga.v() == null)
/*     */       return; 
/* 142 */     nz nz = eos/moe/dragoncore/tga.v();
/* 143 */     Map<String, bo> map = eos/moe/dragoncore/tga.v();
/*     */ 
/*     */     
/* 146 */     zz zz = new zz(entityLivingBase, map);
/*     */     
/* 148 */     LinkedHashMap<Object, Object> linkedHashMap = new LinkedHashMap<>();
/*     */ 
/*     */     
/* 151 */     linkedHashMap.put("base", new be("base", ee.w, 1.0F));
/*     */     
/* 153 */     for (dy dy : nz.v()) {
/* 154 */       linkedHashMap.remove(dy.h());
/*     */       
/* 156 */       linkedHashMap.put(dy.h(), new be(dy.h(), ee.v(dy.z()), dy
/* 157 */             .v(), zz.v(dy.v())));
/*     */       
/* 159 */       for (String str : dy.v()) {
/* 160 */         zz.l.put(str, dy.h());
/*     */       }
/*     */     } 
/* 163 */     zz.v((LinkedHashMap)linkedHashMap);
/*     */     
/* 165 */     for (Map.Entry<String, String> entry : nz.v().entrySet()) {
/* 166 */       zz.z((String)entry.getKey(), (String)entry.getValue());
/*     */     }
/* 168 */     zz.d = nz.v();
/*     */     
/* 170 */     zz.f = entityLivingBase.func_70005_c_();
/* 171 */     zz.s = entityLivingBase.func_110124_au();
/* 172 */     zz.v(st.w, new String[0]);
/*     */     
/* 174 */     this.g.put(entityLivingBase.func_110124_au(), zz);
/*     */   }
/*     */ 
/*     */   
/*     */   public zz getEntityManager(UUID uUID) {
/* 179 */     return (zz)this.g.getIfPresent(uUID);
/*     */   }
/*     */   
/*     */   public void startAnimation(zz zz1, String str, int i, float f) {
/* 183 */     if (f == 0.0F) {
/* 184 */       f = 1.0F;
/*     */     }
/*     */     
/* 187 */     if (zz1.v(st.f, new String[] { str })) {
/*     */       return;
/*     */     }
/* 190 */     Map.Entry<String, bo> entry = zz1.v(str);
/* 191 */     bo bo = entry.getValue();
/* 192 */     str = entry.getKey();
/* 193 */     if (bo == null) {
/*     */       return;
/*     */     }
/* 196 */     gk gk = new gk(bo);
/* 197 */     gk.v(i);
/* 198 */     gk.v(f);
/*     */     
/* 200 */     be be = getAnimationLayer(zz1, str);
/*     */ 
/*     */     
/* 203 */     if (be.v() != null) {
/* 204 */       String str1 = be.v().z();
/*     */       
/* 206 */       Map.Entry<String, bo> entry1 = zz1.v(str1);
/* 207 */       bo bo1 = entry1.getValue();
/* 208 */       if (bo1 != null) {
/* 209 */         gk gk1 = new gk(bo1);
/* 210 */         gk1.v(0);
/* 211 */         gk.v(gk1);
/*     */       } 
/*     */     } 
/*     */ 
/*     */     
/* 216 */     zz1.v(gk, be.v());
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void stopAnimation(zz zz1, String str, int i) {
/* 227 */     Map.Entry<String, bo> entry1 = zz1.v(str);
/* 228 */     if (entry1.getValue() == null)
/*     */       return; 
/* 230 */     str = entry1.getKey();
/* 231 */     if (zz1.v(st.s, new String[] { str })) {
/*     */       return;
/*     */     }
/* 234 */     Map.Entry<String, bo> entry2 = zz1.v(str);
/* 235 */     str = entry2.getKey();
/*     */     
/* 237 */     be be = getAnimationLayer(zz1, str);
/* 238 */     if (isPlayingAnimation(be, str)) {
/* 239 */       zz1.v(be.v(), i);
/*     */     }
/*     */   }
/*     */   
/*     */   public String getPlayingAnimation(UUID uUID, String str) {
/* 244 */     zz zz = (zz)this.g.getIfPresent(uUID);
/* 245 */     if (zz != null) {
/* 246 */       be be = zz.v(str);
/* 247 */       if (be != null) {
/* 248 */         ji ji = be.v();
/* 249 */         if (ji != null) {
/* 250 */           if (ji instanceof ci) {
/* 251 */             return ((ci)ji).z().v();
/*     */           }
/* 253 */           return ji.v().v();
/*     */         } 
/*     */       } 
/*     */     } 
/*     */     
/* 258 */     return "";
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public boolean isPlayingAnimation(zz zz1, String str) {
/* 264 */     str = zz1.v(str).getKey();
/*     */     
/* 266 */     be be = getAnimationLayer(zz1, str);
/*     */     
/* 268 */     return isPlayingAnimation(be, str);
/*     */   }
/*     */   
/*     */   public boolean isPlayingAnimation(be be1, String str) {
/* 272 */     ji ji = be1.v();
/* 273 */     if (ji != null) {
/* 274 */       if (ji.v() == null) {
/* 275 */         return false;
/*     */       }
/* 277 */       if (ji.v().v() || !ji.v(System.currentTimeMillis())) {
/* 278 */         if (ji instanceof ci) {
/* 279 */           ci ci = (ci)ji;
/* 280 */           bo bo = ci.z();
/* 281 */           return (bo != null && bo.v().contains(str));
/*     */         } 
/* 283 */         return ji.v().v().contains(str);
/*     */       } 
/*     */     } 
/*     */ 
/*     */     
/* 288 */     return false;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public be getAnimationLayer(zz zz1, String str) {
/* 296 */     String str1 = zz1.z().get(str);
/* 297 */     if (str1 == null) {
/* 298 */       str1 = "base";
/*     */     }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/* 305 */     return zz1.v(str1);
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\kq.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */